Skip to content

Instantly share code, notes, and snippets.

git_current_branch () {
local ref
ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null)
local ret=$?
if [[ $ret != 0 ]]
then
[[ $ret == 128 ]] && return
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
fi
echo ${ref#refs/heads/}
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 9, 2024 20:56
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@lawndoc
lawndoc / cloc-gh
Last active May 9, 2024 20:53
Count the total lines of code for a user or organization in GitHub (excludes forks)
#!/usr/bin/env bash
# Author: C.J. May @lawndoc
# Usage: cloc-gh <username>
# Prereqs: cloc gh
cloc_repo () {
gh repo clone "$1" temp-linecount-repo -- --depth 1 > /dev/null 2>&1 &&
cloc temp-linecount-repo | grep SUM | awk '{ print $5 }' >> line_count.txt &&
rm -rf temp-linecount-repo
@Nyr
Nyr / imgur-direct-images.user.js
Last active May 9, 2024 20:48
Redirect imgur to the raw images skipping the crappy HTML pages
// ==UserScript==
// @name imgur direct images
// @description Redirect to the raw images skipping the crappy HTML pages.
// @include /^https?:\/\/imgur\.com\/[A-Za-z0-9]+$/
// @exclude *imgur.com/vidgif
// @exclude *imgur.com/jobs
// @exclude *imgur.com/about
// @exclude *imgur.com/apps
// @exclude *imgur.com/tos
// @exclude *imgur.com/privacy

To use devices inside your nspawn container do:

Edit systemd-nspawn@<machine_name>.service and add a line like the below

DeviceAllow="/dev/serial/by-id/usb-Roboteq_Motor_Controller_SDC2XXX-if00 rwm"
DeviceAllow=char-ttyACM rwm
DeviceAllow=char-usb_device rwm
DeviceAllow=ttyACM rwm

To see valid device types do:

@file:OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
package de.kuno.listsections
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateRectAsState
import androidx.compose.foundation.ExperimentalFoundationApi
@rxaviers
rxaviers / gist:7360908
Last active May 9, 2024 20:41
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue:
@JTraversa
JTraversa / SWIV.json
Last active May 9, 2024 20:41
SWIV Retroactive Distribution
{
"0xe14c894FFA7404d493217Cd97Cdca415979f750D": "2000000000000000000000",
"0x68251b5f3889b1B98349f8aF8dbC1FAc75Ab4Ce9": "2000000000000000000000",
"0xC7D2c67bC38b0E8b15B632c19Ef629022FD56543": "4000000000000000000000",
"0x5517968D4289e068aA74b4Aa9450aa18eE2d14A3": "4000000000000000000000",
"0x01628A344a6E8Db2aa3E0954BC2C2D1e26444f9D": "5937007874015748300000",
"0x7eb6d04f63521a2e993F5D74F5e18a3e99085BB7": "2000000000000000000000",
"0x087Eae3a20901197F68bAb6fAD5966254c8Dd52e": "2000000000000000000000",
"0xF72F3240728C65F04948bC28a7F6772B590cb56F": "5937007874015748300000",
"0x5DdA68A8990038a13f8B4937e01Be1236c36C018": "4000000000000000000000",
@wojteklu
wojteklu / clean_code.md
Last active May 9, 2024 20:37
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules